﻿@model List<DLULearningNetworkModel.Friend>
@{
    //Guid curUserID = DLULearningNetwork.ActionFilterAttributes.RequireUserLogin.LoginUser.AccountID_u;
    DLULearningNetworkModel.Account accountOwner = ViewBag.AccountOwner;
    DLULearningNetworkModel.Account accountOfFriend = null;
}
@using DLULearningNetwork.Libs
@if (Model != null && Model.Count > 0)
{
    <table class="tbl1" cellspacing="0" style="margin-top: 10px;">
        <tr>
            <th>
                Avatar
            </th>
            <th>
                Họ
            </th>
            <th>
                Tên
            </th>
            <th>
                Nickname
            </th>
        </tr>
        @for (int i = 0; i < Model.Count; i++)
        {
            //Undone : sap xep ban theo ten, theo ngay trong model??
            if (Model[i].AccountID_u == accountOwner.AccountID_u)
            {
                accountOfFriend = Model[i].Account1Reference.Value;
            }
            else
            {
                accountOfFriend = Model[i].AccountReference.Value;
            }
            <tr @if (i % 2 != 0)
                {
                    string str = "class=odd"; @str;
                } style="line-height:50px">
                <td>
                <a href="/Userpage/UserHome/@accountOfFriend.Nickname_s">
                @if (!string.IsNullOrEmpty(accountOfFriend.Avatar_s))
                {
                    <img src="@Url.Content(accountOfFriend.Avatar_s)" alt="avatar" style="border:0;width:40px;height:40px;padding-top:5px;"/>
                }
                else
                { 
                    <img src="@Url.Content("~/Content/Images/avatar.gif")" alt="avatar" style="border:0;width:40px;height:40px;padding-top:5px;"/>
                }
                </a>
                </td>
                <td>
                    <span style="display: block;">@accountOfFriend.LastName_s</span>
                </td>
                <td>
                    <span style="display: block;">@accountOfFriend.FirstName_s</span>
                </td>
                <td>
                    <span style="display: block;">@accountOfFriend.Nickname_s</span>
                </td>
            </tr>
        }
    </table>
    <div class="pagination pagination-left" style="margin-left: 3px;">
        <ul class="pager">
            @Html.Partial("UCPager2", new DLULearningNetwork.ViewModels.PagerViewModel2(ViewBag.TotalItems, Constants.DEFAULT_PAGESIZE, Constants.DEFAULT_NUMBER_OF_ITEMS_PERPAGE,
                 ViewBag.CurrentPage))
        </ul>
    </div>
}
else
{
    <span>Không có bạn nào</span>
}
